#!/bin/bash

files="-assembly build/Anculus.Core.dll -assembly build/Anculus.Core.Extended.dll -assembly build/Anculus.Gui.dll"
updated_version=""

function usage ()
{
	echo "Usage : docgen [options]"
	echo ""
	echo "Available options:"
	echo "	--update <version>	Update the documentation, adds '<since xxx >' elements"
	echo "	--create		Create documentation"
	echo "	--assemble		Package documentation"
	echo "	--edit			Launch monodoc in edit mode"
	echo ""
}

while test x$1 != x; do
	case $1 in
		--update=*)
			updated_version=`echo $1 | sed 's/--update=//'`
			monodocer $files -delete --path docs/api -pretty -since $updated_version
			exit
			;;
		--update)
			shift
			updated_version=$1
			monodocer $files -delete --path docs/api -pretty -since $updated_version
			exit
			;;
		--create)
			monodocer $files -delete --path docs/api -pretty
			exit
			;;
		--assemble)
			mdassembler --ecma docs/api -o docs/sources/libanculus-sharp
			exit
			;;
		--edit)
			monodoc --edit docs/api
			exit
			;;
		--help)
			usage
			exit
			;;
		*)
			echo Unknown argument $1 >&2
			usage
			exit 1
			;;
	esac
	shift
done

usage
